#define _CRT_SECURE_NO_WARNINGS 1


#include<vector>
#include<iostream>

using namespace std;

int main()
{
	int n = 0;
	while (cin >> n)
	{
		vector<int> v(n);
		int max = 0, min = 0;
		double sum = 0;

		for (int i = 0; i < n; i++)
		{
			cin >> v[i];
			if (v[i] > v[max])
			{
				max = i;
			}
			else if (v[i] < v[min])
			{
				min = i;
			}
		}

		for (int i = 0; i < n; i++)
		{
			if (i != max && i != min)
			{
				sum += (double)v[i];
			}
		}

		printf("%.2lf\n", sum / (double)(n - 2));
	}

	return 0;
}